package com.dlkj.threadPool.controller;

import com.alibaba.fastjson.JSONObject;
import com.dlkj.threadPool.core.httpClient.HttpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName HttpController
 * @Author leimingfeng
 * @Date 2019/9/12 15:21
 * @Description http 请求测试类
 * @Version 1.0
 **/
@RestController
public class HttpController {

    @Autowired
    private HttpService httpService;

    @GetMapping("/person")
    public JSONObject person(String idCard){
        String url = "https://rsfw.jiangmen.cn/Jmqyfwpt/yueshangtong/subsidy/common/personBaseInfo.do";
//        String url = "https://www.cnblogs.com/poterliu/p/9373478.html";
        Map<String, Object> param = new HashMap<>(1);
        param.put("idcard",idCard);
        JSONObject person = new JSONObject();
        try {
            String s = httpService.doGet(url,param);
            person = JSONObject.parseObject(s);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return person;
    }
}
